package com.lg.partition64;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/3/24 10:53
 */
public class P6374StOI_1_树上询问 {

    private static final int N = 500010, M = 2 * N, D = (int) (Math.log(N) / Math.log(2));
    private static int[] h = new int[N], e = new int[M], ne = new int[M];
    private static int[] depth = new int[N], size = new int[N];
    private static int[][] f = new int[N][D + 1];
    private static int[] q = new int[N];
    private static int n, m, idx = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        m = Integer.parseInt(ss[1]);
        Arrays.fill(h, -1);
        for (int i = 0; i < n - 1; i++) {
            ss = reader.readLine().split(" ");
            int a = Integer.parseInt(ss[0]), b = Integer.parseInt(ss[1]);
            add(a, b);
            add(b, a);
        }
        dfs(1, -1);
        bfs(1);
        for (int i = 0; i < m; i++) {
            ss = reader.readLine().split(" ");
            int a = Integer.parseInt(ss[0]), b = Integer.parseInt(ss[1]), c = Integer.parseInt(ss[2]);
            int k = lca(a, b);
            //如果c就是a和b的lca，那么需要减去a和b所在子树的大小
            if (k == c) writer.write((n - getSize(c, a) - getSize(c, b)) + "\n");
            else {
                int k1 = lca(a, c), k2 = lca(b, c);
                if (k1 == k2 && k1 != k) {
                    writer.write("0\n");
                    continue;
                }
                if (k1 == c) writer.write((size[c] - getSize(c, a)) + "\n");
                else if (k2 == c) writer.write(size[c] - getSize(c, b) + "\n");
                else writer.write("0\n");
            }
        }
        writer.flush();
    }

    //求以root为根节点，x所在子树的大小
    private static int getSize(int root, int x) {
        if (root == x) return 0;
        for (int i = D; i >= 0; i--) {
            if (depth[f[x][i]] > depth[root]) {
                x = f[x][i];
            }
        }
        return size[x];
    }

    private static int lca(int x, int y) {
        if (depth[x] < depth[y]) {
            int t = x;
            x = y;
            y = t;
        }
        for (int i = D; i >= 0; i--) {
            if (depth[f[x][i]] >= depth[y]) x = f[x][i];
        }
        if (x == y) return x;
        for (int i = D; i >= 0; i--) {
            if (f[x][i] == 0 || f[y][i] == 0) continue;
            if (f[x][i] != f[y][i]) {
                x = f[x][i];
                y = f[y][i];
            }
        }
        return f[x][0];
    }

    private static void bfs(int root) {
        int hh = 0, tt = 0;
        q[0] = root;
        depth[root] = 1;
        while (hh <= tt) {
            int u = q[hh++];
            for (int i = h[u]; i != -1; i = ne[i]) {
                int v = e[i];
                if (depth[v] != 0) continue;
                f[v][0] = u;
                depth[v] = depth[u] + 1;
                for (int j = 1; j <= D; j++) {
                    int anc = f[v][j - 1];
                    f[v][j] = f[anc][j - 1];
                }
                q[++tt] = v;
            }
        }
    }

    private static void dfs(int u, int parent) {
        size[u] = 1;
        for (int i = h[u]; i != -1; i = ne[i]) {
            int v = e[i];
            if (v == parent) continue;
            dfs(v, u);
            size[u] += size[v];
        }
    }

    private static void add(int a, int b) {
        e[idx] = b;
        ne[idx] = h[a];
        h[a] = idx++;
    }
}
